# Makefile for cross-compiling to RK3566

# Compiler 
CC = aarch64-linux-gnu-gcc

# Compiler flags
# -I 用于添加搜索路径 
# -I ../ 这里用于添加 gpio_ioctl.h 到搜索路径中
# -I kernel/include 用于添加内核的头文件，ioctl函数会用到
CFLAGS =  -I ../  -I /home/luo/linux_sdk/sdk/kernel/include

# Source files
SRCS = client.c

# Object files
OBJS = $(SRCS:.c=.o)

# Executable name
EXEC = client.bin

# Default target
all: $(EXEC)

# Rule to create executable
$(EXEC): $(OBJS)
	$(CC) $(OBJS) -o $(EXEC)

# Rule to create object files
%.o: %.c
# -c 只编译(compile)和组装(assemble)，不做链接(link)
	$(CC) $(CFLAGS) -c $< -o  $@

# Clean target
clean:
	rm -f $(OBJS) $(EXEC)